package org.example.mytest.control;
import org.example.mytest.entity.User;
import org.example.mytest.mapper.UserOldMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class UserOldcontroller
{
    @Autowired
    public UserOldMapper oldMapper;
    @GetMapping("/Old1")
    public List chazhao()
    {
        List<User> list =oldMapper.findall();
        return list;
    }
    @PostMapping("/old2") //需要借助Swagger或apiPost模拟提交数据
    public String insert1(User user) {
        oldMapper.insert(user);
        return "插入成功";
    }
    @PostMapping("/old3")
    public String shanchu()
    {
        oldMapper.delete1(9);
        return "删除成功";
    }
    @PostMapping("/old4")
    public String gengxin (User user)
    {
        oldMapper.update1(user);
        return "更新成功";
    }
}
